
import 'package:flutter/material.dart';
import 'package:flutter_base/base/base_model.dart';
import 'package:flutter_base/base/base_page.dart';
import 'package:provider/provider.dart';

class BaseStateLessWidget<T extends BaseModel> extends StatelessWidget with BasePage<T>{

  BaseStateLessWidget(){
    init();
  }

  @override
  T createModel() {
    // TODO: implement createModel
    throw UnimplementedError();
  }


  @override
  Widget build(BuildContext context) {
   beforeBuild(context);
    return ChangeNotifierProvider<T>(
      create: (context) => createModel(),
      child: Consumer<T>(builder: (context, data, child) {
        return onBuild(data);
      }),
    );
  }

}